﻿using System;
using System.ComponentModel;
using System.Reflection;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdDbHostAppProgressMeter : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdDbHostAppProgressMeter(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdDbHostAppProgressMeter obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdDbHostAppProgressMeter()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdDbHostAppProgressMeter(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public virtual void start(string displayString)
		{
			GlobalsPINVOKE.OdDbHostAppProgressMeter_start__SWIG_0(this.swigCPtr, displayString);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void start()
		{
			GlobalsPINVOKE.OdDbHostAppProgressMeter_start__SWIG_1(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void stop()
		{
			GlobalsPINVOKE.OdDbHostAppProgressMeter_stop(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void meterProgress()
		{
			GlobalsPINVOKE.OdDbHostAppProgressMeter_meterProgress(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public virtual void setLimit(int max)
		{
			GlobalsPINVOKE.OdDbHostAppProgressMeter_setLimit(this.swigCPtr, max);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdDbHostAppProgressMeter() : this(GlobalsPINVOKE.new_OdDbHostAppProgressMeter(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			this.SwigDirectorConnect();
		}

		private void SwigDirectorConnect()
		{
			if (this.SwigDerivedClassHasMethod("start", OdDbHostAppProgressMeter.swigMethodTypes0))
			{
				this.swigDelegate0 = new OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_0(this.SwigDirectorstart__SWIG_0);
			}
			if (this.SwigDerivedClassHasMethod("start", OdDbHostAppProgressMeter.swigMethodTypes1))
			{
				this.swigDelegate1 = new OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_1(this.SwigDirectorstart__SWIG_1);
			}
			if (this.SwigDerivedClassHasMethod("stop", OdDbHostAppProgressMeter.swigMethodTypes2))
			{
				this.swigDelegate2 = new OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_2(this.SwigDirectorstop);
			}
			if (this.SwigDerivedClassHasMethod("meterProgress", OdDbHostAppProgressMeter.swigMethodTypes3))
			{
				this.swigDelegate3 = new OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_3(this.SwigDirectormeterProgress);
			}
			if (this.SwigDerivedClassHasMethod("setLimit", OdDbHostAppProgressMeter.swigMethodTypes4))
			{
				this.swigDelegate4 = new OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_4(this.SwigDirectorsetLimit);
			}
			GlobalsPINVOKE.OdDbHostAppProgressMeter_director_connect(this.swigCPtr, this.swigDelegate0, this.swigDelegate1, this.swigDelegate2, this.swigDelegate3, this.swigDelegate4);
		}

		private bool SwigDerivedClassHasMethod(string methodName, Type[] methodTypes)
		{
			MethodInfo method = base.GetType().GetMethod(methodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, methodTypes, null);
			return method.DeclaringType.IsSubclassOf(typeof(OdDbHostAppProgressMeter));
		}

		private void SwigDirectorstart__SWIG_0([MarshalAs(UnmanagedType.LPWStr)] string displayString)
		{
			this.start(displayString);
		}

		private void SwigDirectorstart__SWIG_1()
		{
			this.start();
		}

		private void SwigDirectorstop()
		{
			this.stop();
		}

		private void SwigDirectormeterProgress()
		{
			this.meterProgress();
		}

		private void SwigDirectorsetLimit(int max)
		{
			this.setLimit(max);
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		private OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_0 swigDelegate0;

		private OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_1 swigDelegate1;

		private OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_2 swigDelegate2;

		private OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_3 swigDelegate3;

		private OdDbHostAppProgressMeter.SwigDelegateOdDbHostAppProgressMeter_4 swigDelegate4;

		private static Type[] swigMethodTypes0 = new Type[]
		{
			typeof(string)
		};

		private static Type[] swigMethodTypes1 = new Type[0];

		private static Type[] swigMethodTypes2 = new Type[0];

		private static Type[] swigMethodTypes3 = new Type[0];

		private static Type[] swigMethodTypes4 = new Type[]
		{
			typeof(int)
		};

		public delegate void SwigDelegateOdDbHostAppProgressMeter_0([MarshalAs(UnmanagedType.LPWStr)] string displayString);

		public delegate void SwigDelegateOdDbHostAppProgressMeter_1();

		public delegate void SwigDelegateOdDbHostAppProgressMeter_2();

		public delegate void SwigDelegateOdDbHostAppProgressMeter_3();

		public delegate void SwigDelegateOdDbHostAppProgressMeter_4(int max);
	}
}
